<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateLessonsDiscussionReplyTable extends Migration {

	/**
	 * Run the migrations.
     *
     * 对应课堂中的讨论的回复数据表。
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('lesson_discussion_replies', function(Blueprint $table){
            $table->increments('id')->comment('主键id');
            $table->text('content')->comment('内容');

            $table->unsignedInteger('creater_id')->comment('创建者id');
            $table->foreign('creater_id')->references('id')->on('users')->onDelete('cascade');

			$table->unsignedInteger('discussion_id')->comment('对应的讨论id');
			$table->foreign('discussion_id')->references('id')->on('lesson_discussions')->onDelete('cascade');
            $table->timestamps();
        });
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('lesson_discussion_replies');
	}

}
